from selenium import webdriver
from selenium.webdriver.common.by import By
import time

d = webdriver.Chrome()
d.get('https://www.baidu.com')
print(d.title) # 获取标题
print(d.current_url) # 获取当前窗口的网址

# 获取属性对应的值  get_attribute('属性名称') 获取该属性对应的值
a = d.find_element(By.CSS_SELECTOR, '[id="su"]')
res = a.get_attribute('class')
print(res)

# 获取文本信息  .text获取该元素的文本信息
b = d.find_element(By.CSS_SELECTOR, '[class="title-content-title"]')
res2 = b.text
print(res2)